package club.xyes.zkh.ecommerce.dao.mapper;

import club.xyes.zkh.ecommerce.commons.entity.WxFormId;
import club.xyes.zkh.ecommerce.dao.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * Create by 郭文梁 2019/5/6 0006 13:13
 * WxFormIdMapper
 * 微信FormId数据库访问对象
 *
 * @author 郭文梁
 * @data 2019/5/6 0006
 */
@Repository
public interface WxFormIdMapper extends BaseMapper<WxFormId> {
    /**
     * 通过appId和OpenId获取最老的一个FormId
     *
     * @param appId  AppId
     * @param openId openId
     * @return formId
     */
    WxFormId selectOneByAppIdAndOpenId(@Param("appId") String appId,
                                       @Param("openId") String openId);

    /**
     * 删除已过期的FormId
     *
     * @return 删除的数据量
     */
    int deleteExpired();
}
